package com.distribute.framework.dao;

import java.util.List;
import java.util.Map;

import com.distribute.framework.core.util.Function;
import com.distribute.framework.core.web.util.Page;
import com.distribute.framework.model.Replenishment;

/**
 * 补货明细的Dao接口
 * @author 飞啊飘啊
 */
@SuppressWarnings("unchecked")
public interface IReplenishmentDao
{
	/**
	 * 获取所有补货明细
	 * @return
	 */
	public List<Replenishment> getReplenishmentList(Map params,Integer offset,Integer size);

	/**
	 * 获取补货明细统计
	 * @return
	 */
	public List getReplenishmentStats(Map params,Map<String,Object> groups,Map<String,Object> sums);

	/**
	 * 获取补货明细总数
	 * @return
	 */	
	public Long getReplenishmentCount(Map params);
	
	/**
	 * 获取补货明细自定义求和表达式,比如求和:eval="sum(id)"
	 * @return
	 */	
	public <T> T getReplenishmentEval(String eval,Map params);
	
	/**
	 * 获取补货明细分页
	 * @return
	 */	
	public Page getReplenishmentPage(int page,int size,Map params);
	
	/**
	 * 根据查询条件取补货明细
	 * @param params
	 * @return
	 */
	public Replenishment getReplenishment(Map params);	

	/**
	 * 根据ID取补货明细
	 * @param id
	 * @return
	 */
	public Replenishment getReplenishmentById(Long id);


	
	

	/**
	 * 保存补货明细
	 * @param replenishment
	 */
	public Replenishment saveReplenishment(Replenishment replenishment);

	/**
	 * 更新补货明细
	 * @param replenishment
	 */
	public int updateReplenishment(Replenishment replenishment);
	/**
	 * 更新补货明细非空字段
	 * @param replenishment
	 */
	public int updateReplenishment$NotNull(Replenishment replenishment);

	/**
	 * 根据ID删除一个补货明细
	 * @param id
	 */
	public void deleteReplenishmentById(Long id);
	/**
	 * 根据ID逻辑删除一个补货明细
	 * @param id
	 */
	public void removeReplenishmentById(Long id);
	/**
	 * 根据条件更新补货明细
	 * @param values
	 * @param params
	 */
	public int updateReplenishmentByConfirm(Map values, Map params);
	/**
	 * 根据条件删除补货明细
	 * @param params
	 */
	public void deleteReplenishmentByConfirm(Map params);
	
	/**
	 * 执行过程，以便事务回滚
	 * @param function
	 */
	public <T> T executeTransaction(Function function);

}